{% extends "CmsBundle::base.html.twig" %}

{% block pluginStyles %}
    <link rel="stylesheet" href="/assets/cms/css/chosen.min.css" />
{% endblock %}

{% block pageContent %}
    <!-- PAGE CONTENT BEGINS -->
    <form class="form-horizontal" role="form" action="{{ path("yearnfar_cms_term_edit") }}" method="post">
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 分类名称： </label>
            <div class="col-sm-9">
                <input type="hidden" name="tid" class="col-xs-10 col-sm-5" value="{{ current.id }}">
                <input type="text" name="name" class="col-xs-10 col-sm-5" value="{{ current.name }}">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 上一级分类：</label>
            <div class="col-sm-9">
                <select class="width-20 chosen-select" name="pid" id="form-field-select-3" data-placeholder="选择一个分类...">
                    <option value="0">顶级分类</option>
                    {% for item in term %}
                        {% if item.id==current.pid %}
                            <option value="{{ item.id }}" selected="selected">{{ item.name2 }}</option>
                        {%  elseif item.id != current.id %}
                            <option value="{{ item.id }}">{{ item.name2 }}</option>
                        {% endif %}
                    {% endfor %}
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 唯一标识： </label>
            <div class="col-sm-9">
                <input type="text" name="identify" class="col-xs-10 col-sm-5" value="{{ current.identify2 }}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 分类描述： </label>
            <div class="col-sm-9">
                <textarea class="col-sm-4 col-xs-3" name="description" style="width: 480px; height: 120px;">{{ current.description }}</textarea>
            </div>
        </div>
        <div class="clearfix form-actions">
            <div class="col-md-offset-3 col-md-9">
                <button class="btn btn-info" type="submit" name="submit" value="1">
                    <i class="icon-ok bigger-110"></i>
                    提交
                </button>

                &nbsp; &nbsp; &nbsp;
                <button class="btn" type="reset">
                    <i class="icon-undo bigger-110"></i>
                    重置
                </button>
            </div>
        </div>
    </form>
    <!-- PAGE CONTENT ENDS -->
{% endblock %}

{% block pluginScripts %}
    <script src="/assets/cms/js/chosen.jquery.min.js"></script>
{% endblock %}

{% block inlineScripts %}
    <script type="text/javascript">
        $(".chosen-select").chosen();
    </script>
{% endblock %}